VT-d: fix a bug in enable_ats_device
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 3 Feb 2010 09:46:38 +0000 (09:46 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 3 Feb 2010 09:46:38 +0000 (09:46 +0000)
In enable_ats_device, it should enable ATS if find matched atsr unit
for a device, and don't enable it if no matched atsr unit. But current
code does contrarily. This patch fixes it.

Signed-off-by: Weidong Han <Weidong.han@intel.com>
xen/drivers/passthrough/vtd/x86/ats.c

index 4f0ab75fe1b6acee4952dbaebb1c8b4fa902a771..3c325385165058aeb45aff8c7a7d0857e7f13f9d 100644 (file)
@@ -118,8 +118,13 @@ int enable_ats_device(int seg, int bus, int devfn)
     u16 queue_depth;
     int pos;
 
-    if ( acpi_find_matched_atsr_unit(bus, devfn) )
+    if ( !acpi_find_matched_atsr_unit(bus, devfn) )
+    {
+        dprintk(XENLOG_WARNING VTDPREFIX,
+                "cannot find matched atsr for %x:%x.%x\n",
+                bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
         return 0;
+    }
 
     pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
     if ( !pos )